<template>
  <div id="index" ref="appRef">
    <div class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body">
        <div class="d-flex jc-center">
          <dv-decoration-10 class="dv-dec-10"/>
          <div class="d-flex jc-center">
            <dv-decoration-8 class="dv-dec-8" :color="decorationColor"/>
            <div class="title">
              <span class="title-text">云农职疫情大数据监控平台</span>
              <dv-decoration-6
                  class="dv-dec-6"
                  :reverse="true"
                  :color="['#50e3c2', '#67a1e5']"
              />
            </div>
            <dv-decoration-8
                class="dv-dec-8"
                :reverse="true"
                :color="decorationColor"
            />
          </div>
          <dv-decoration-10 class="dv-dec-10-s"/>
        </div>

        <!-- 第二行 -->
        <div class="d-flex jc-between px-2">
          <div class="d-flex aside-width">
            <div class="react-left ml-4 react-l-s" style="background-color: #1a5cd7" @click="ynnz">
              <span class="react-left" style="background-color: #1a5cd7"></span>
              <span class="text">疫情信息大屏</span>
            </div>
            <div class="react-left ml-3" @click="inter">
              <span class="text">互联网学院数据大屏</span>
            </div>
          </div>
          <div class="d-flex aside-width">
            <div class="react-right bg-color-blue mr-3">
              <span class="text fw-b">疫情常态化指数</span>
            </div>
            <div class="react-right mr-4 react-l-s">
              <span class="react-after"></span>
              <span class="text"
              >{{ dateYear }} {{ dateWeek }} {{ dateDay }}</span
              >
            </div>
          </div>
        </div>

        <div class="body-box">
          <!-- 第三行数据 -->
          <div class="content-box">
            <div>
              <dv-border-box-12>
                <centerLeft1/>
              </dv-border-box-12>
            </div>
            <div style="width: 250px">
              <dv-border-box-12>
                <center-left2/>
              </dv-border-box-12>
            </div>
            <!-- 中间 -->
            <div style="width: 850px;height: 156px">
              <dv-border-box-12>
                <center/>
              </dv-border-box-12>
            </div>
            <div style="width: 420px;">
              <dv-border-box-13>
                <centerRight1/>
              </dv-border-box-13>
            </div>
          </div>

          <!-- 第四行数据 -->
          <div class="bototm-box" style="padding: 0px; margin: 0px">
            <div style="width: 610px;">
              <dv-border-box-13>
                <bottomLeft/>
              </dv-border-box-13>
            </div>
            <div style="width: 850px;margin-top: -260px;margin-left: -331px">
              <dv-border-box-13>
                <bottomCenterChart/>
              </dv-border-box-13>
            </div>
            <div style="width: 420px;margin-top: -520px;margin-left: 1460px">
              <dv-border-box-13>
                <bottomRight/>
              </dv-border-box-13>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import drawMixin from "../../utils/drawMixin";
import {formatTime} from '../../utils'
import centerLeft1 from '../ynnz-module/centerLeft1'
import centerLeft2 from '../ynnz-module/centerLeft2'
import centerRight1 from '../ynnz-module/centerRight1'
import center from '../ynnz-module/center'
import bottomLeft from '../ynnz-module/bottomLeft'
import bottomCenterChart from '../ynnz-module/bottomCenterChart'
import bottomRight from '../ynnz-module/bottomRight'

export default {
  mixins: [drawMixin],
  data() {
    return {
      timing: null,
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
      decorationColor: ['#568aea', '#000000']
    }
  },
  components: {
    centerLeft1,
    centerLeft2,
    centerRight1,
    bottomCenterChart,
    center,
    bottomLeft,
    bottomRight
  },
  mounted() {
    this.timeFn()
    this.cancelLoading()
  },
  beforeDestroy() {
    clearInterval(this.timing)
  },
  methods: {
    timeFn() {
      this.timing = setInterval(() => {
        this.dateDay = formatTime(new Date(), 'HH: mm: ss')
        this.dateYear = formatTime(new Date(), 'yyyy-MM-dd')
        this.dateWeek = this.weekday[new Date().getDay()]
      }, 1000)
    },
    cancelLoading() {
      setTimeout(() => {
        this.loading = false
      }, 4000)
    },
    inter() {
      this.$confirm('是否前往互联网管理界面？', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$router.push("/int")
      })
    },
    ynnz() {
      this.$router.push("/ynnz")
    }
  }
}
</script>

<style lang="scss" scoped>
@import '../../assets/scss/index';
</style>
